package com.ymttest.database.mapping.withdraw;

import java.util.List;
import java.util.Map;

import com.ymttest.database.model.withdraw.Ymt_FundAccountFreeze;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface Ymt_FundAccountFreezeMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table Ymt_FundAccountFreeze
     *
     * @mbggenerated Mon Jun 17 14:33:54 CST 2019
     */
    @Delete({
        "delete from Ymt_FundAccountFreeze",
        "where Id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table Ymt_FundAccountFreeze
     *
     * @mbggenerated Mon Jun 17 14:33:54 CST 2019
     */
    @Insert({
        "insert into Ymt_FundAccountFreeze (Id, UserId, ",
        "AccountId, LoginId, ",
        "FreezeAmount, FreezeReason, ",
        "FreezeMemo, FreezeStatus, ",
        "FreezeTime, FreezeOperatorId, ",
        "FreezeOperatorName, UnFreezeTime, ",
        "UnFreezeOperatorId, UnFreezeOperatorName, ",
        "AccountFrozenInvoiceId, AccountUnFrozenInvoiceId)",
        "values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, ",
        "#{accountId,jdbcType=NVARCHAR}, #{loginId,jdbcType=NVARCHAR}, ",
        "#{freezeAmount,jdbcType=DECIMAL}, #{freezeReason,jdbcType=INTEGER}, ",
        "#{freezeMemo,jdbcType=NVARCHAR}, #{freezeStatus,jdbcType=INTEGER}, ",
        "#{freezeTime,jdbcType=TIMESTAMP}, #{freezeOperatorId,jdbcType=INTEGER}, ",
        "#{freezeOperatorName,jdbcType=NVARCHAR}, #{unFreezeTime,jdbcType=TIMESTAMP}, ",
        "#{unFreezeOperatorId,jdbcType=INTEGER}, #{unFreezeOperatorName,jdbcType=NVARCHAR}, ",
        "#{accountFrozenInvoiceId,jdbcType=VARCHAR}, #{accountUnFrozenInvoiceId,jdbcType=VARCHAR})"
    })
    int insert(Ymt_FundAccountFreeze record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table Ymt_FundAccountFreeze
     *
     * @mbggenerated Mon Jun 17 14:33:54 CST 2019
     */
    @InsertProvider(type=Ymt_FundAccountFreezeSqlProvider.class, method="insertSelective")
    int insertSelective(Ymt_FundAccountFreeze record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table Ymt_FundAccountFreeze
     *
     * @mbggenerated Mon Jun 17 14:33:54 CST 2019
     */
    @Select({
        "select",
        "Id, UserId, AccountId, LoginId, FreezeAmount, FreezeReason, FreezeMemo, FreezeStatus, ",
        "FreezeTime, FreezeOperatorId, FreezeOperatorName, UnFreezeTime, UnFreezeOperatorId, ",
        "UnFreezeOperatorName, AccountFrozenInvoiceId, AccountUnFrozenInvoiceId",
        "from Ymt_FundAccountFreeze",
        "where Id = #{id,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="Id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="UserId", property="userId", jdbcType=JdbcType.INTEGER),
        @Result(column="AccountId", property="accountId", jdbcType=JdbcType.NVARCHAR),
        @Result(column="LoginId", property="loginId", jdbcType=JdbcType.NVARCHAR),
        @Result(column="FreezeAmount", property="freezeAmount", jdbcType=JdbcType.DECIMAL),
        @Result(column="FreezeReason", property="freezeReason", jdbcType=JdbcType.INTEGER),
        @Result(column="FreezeMemo", property="freezeMemo", jdbcType=JdbcType.NVARCHAR),
        @Result(column="FreezeStatus", property="freezeStatus", jdbcType=JdbcType.INTEGER),
        @Result(column="FreezeTime", property="freezeTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="FreezeOperatorId", property="freezeOperatorId", jdbcType=JdbcType.INTEGER),
        @Result(column="FreezeOperatorName", property="freezeOperatorName", jdbcType=JdbcType.NVARCHAR),
        @Result(column="UnFreezeTime", property="unFreezeTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="UnFreezeOperatorId", property="unFreezeOperatorId", jdbcType=JdbcType.INTEGER),
        @Result(column="UnFreezeOperatorName", property="unFreezeOperatorName", jdbcType=JdbcType.NVARCHAR),
        @Result(column="AccountFrozenInvoiceId", property="accountFrozenInvoiceId", jdbcType=JdbcType.VARCHAR),
        @Result(column="AccountUnFrozenInvoiceId", property="accountUnFrozenInvoiceId", jdbcType=JdbcType.VARCHAR)
    })
    Ymt_FundAccountFreeze selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table Ymt_FundAccountFreeze
     *
     * @mbggenerated Mon Jun 17 14:33:54 CST 2019
     */
    @UpdateProvider(type=Ymt_FundAccountFreezeSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(Ymt_FundAccountFreeze record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table Ymt_FundAccountFreeze
     *
     * @mbggenerated Mon Jun 17 14:33:54 CST 2019
     */
    @Update({
        "update Ymt_FundAccountFreeze",
        "set UserId = #{userId,jdbcType=INTEGER},",
          "AccountId = #{accountId,jdbcType=NVARCHAR},",
          "LoginId = #{loginId,jdbcType=NVARCHAR},",
          "FreezeAmount = #{freezeAmount,jdbcType=DECIMAL},",
          "FreezeReason = #{freezeReason,jdbcType=INTEGER},",
          "FreezeMemo = #{freezeMemo,jdbcType=NVARCHAR},",
          "FreezeStatus = #{freezeStatus,jdbcType=INTEGER},",
          "FreezeTime = #{freezeTime,jdbcType=TIMESTAMP},",
          "FreezeOperatorId = #{freezeOperatorId,jdbcType=INTEGER},",
          "FreezeOperatorName = #{freezeOperatorName,jdbcType=NVARCHAR},",
          "UnFreezeTime = #{unFreezeTime,jdbcType=TIMESTAMP},",
          "UnFreezeOperatorId = #{unFreezeOperatorId,jdbcType=INTEGER},",
          "UnFreezeOperatorName = #{unFreezeOperatorName,jdbcType=NVARCHAR},",
          "AccountFrozenInvoiceId = #{accountFrozenInvoiceId,jdbcType=VARCHAR},",
          "AccountUnFrozenInvoiceId = #{accountUnFrozenInvoiceId,jdbcType=VARCHAR}",
        "where Id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(Ymt_FundAccountFreeze record);
    
    @Select({
    	"select sum(FreezeAmount) as sumFreezeAmount from Ymt_FundAccountFreeze  where userid=#{userId} and FreezeStatus=0"
    })
    List<Map> getSumFreezebyUserId(Integer userId);
    
    
}